//
//  TTShopCartSubDetailModel.m
//  TaoTuo
//
//  Created by admin on 2019/9/2.
//  Copyright © 2019 admin. All rights reserved.
//

#import "TTShopCartSubDetailModel.h"

@implementation TTShopCartSubDetailModel


+ (NSDictionary *)modelCustomPropertyMapper {
    return @{
             @"CertImage"  : @"CertInfo.CertImage",
             @"CertName" : @"CertInfo.CertName",
             @"CertNumber" : @"CertInfo.CertNumber",
             @"CertType" : @"CertInfo.CertType",
             @"QueryCode" : @"CertInfo.QueryCode",
    };
}
    
+ (nullable NSDictionary<NSString *, id> *)modelContainerPropertyGenericClass
{
    return @{@"DiamondsInfo" : @"TTShopCartDiamondParamsModel"};
}

- (id)copyWithZone:(NSZone *)zone
{
    TTShopCartSubDetailModel *model = [[[self class] allocWithZone:zone] init];

    // 取出所有属性和实例变量
    unsigned int count = 0;
    Ivar *ivars = class_copyIvarList([self class], &count);
    for (int i = 0; i < count; i++) {

        const char *name = ivar_getName(ivars[i]);
        NSString *key = [[NSString alloc] initWithUTF8String:name];
//        NSLog(@"> key = %@", key);

        // 使用 KVC 方式取值
        id value = [self valueForKey:key];
//        NSLog(@"使用 KVC 方式取值 ---> %@, %@ = %@", [value className], key, value);
        [model setValue:value forKey:key];


    }
    free(ivars);

    return model;
}

@end
